<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%

	Class.forName("com.mysql.jdbc.Driver");					
	Connection conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/toursim", "root", "gaoxing311");
	
	//获取被修改的用户的ID
	String id=request.getParameter("id");
	//根据ID查询被修改用户的所有详细信息
	String sql="select * from senior where id = ?";
	
	PreparedStatement ps=conn.prepareStatement(sql);
	ps.setInt(1, Integer.parseInt(id));
	
	//获取查询结果
	ResultSet rs=ps.executeQuery();

 %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>修改信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	
  </head>

  <body>
  	修改
  	<%
  		//如果查询到了任意结果,就获取第一条结果,并显示表单
  		if(rs.next()){
  	 %>
	<form action="update.jsp" method="post">
		<input type="hidden" name="id"  value="<%=rs.getInt(1)%>">
		<table>
	   		<tr>
	   			<td>景点名</td>
	   			<td><input type="text" name="name" value="<%=rs.getString(2)%>"></td>
	   		</tr>
	   		<tr>
	   			<td>价格</td>
	   			<td><input type="text" name="price" value="<%=rs.getString(3)%>"></td>
	   			
	   		</tr>
	   		<tr>
	   			<td>景点介绍</td>
	   			<td><input type="text" name="intro" value="<%=rs.getString(4)%>"></td>
	   		</tr>
	   		<tr>
	   			<td>省份</td>
	   			<td><input type="text"  name="proc" value="<%=rs.getString(5)%>"></td>
	   		</tr>
	   		<tr>
	   			<td>城市</td>
	   			<td><input type="text" name="city"  value="<%=rs.getString(6)%>"></td>
	   		</tr>
	   		<tr>
	   			<td>地址</td>
	   			<td><input type="text" name="addr" value="<%=rs.getString(7)%>"></td>
	   		</tr>
	   		<tr>
	   			<td>景点图片网址</td>
	   			<td><input type="text" name="img_intro" value="<%=rs.getString(8)%>"></td>
	   		</tr>
	   		<tr>
	   			<td><input type="submit" value="修改"></td>
	   		</tr>
	   	</table>
	</form> 
	<%} %>  	
  </body>
</html>
